using SqlSugar;

namespace SqlSugarLearing
{
    public class DbHelper
    {
        // static string typeMysql = "server=192.168.16.106;port=3306;user=root;password=123456; database=testdb;";
        static string typeSqlServer = "Data Source=sqlserver.dev.yitong.com;Initial Catalog=yt_order_online;User Id=sa;Password=ritrosUvepU9hucRiwRo; ";
        private static SqlSugarClient _instanceDb;
        public static SqlSugarClient Db
        {
            get
            {
                if (_instanceDb == null)
                {
                    _instanceDb = new SqlSugarClient(new ConnectionConfig()
                    {
                        ConnectionString = typeSqlServer,//连接符字串
                        DbType = DbType.SqlServer,
                        IsAutoCloseConnection = true,
                        InitKeyType = InitKeyType.Attribute//从特性读取主键自增信息
                    });
                }
                return _instanceDb;
            }
        }
    }
}